from datetime import datetime,timedelta

#打印当前的时间
print(datetime.now())

##用指定日期创建
# c=datetime(2019, 5, 23, 12, 20)
# print(c)

#将以下字符串转换成datetime类型：
d=datetime.strptime('2017/9/30','%Y/%m/%d')
print(d)

#将datetime时间转换成字符串时间
date = datetime(2020,7,12)
o = datetime.strftime(date,"%Y-%m-%d")
print(o)

date1 = date = datetime(2020,7,12)
date2 = date1-timedelta(days=8)
print(date2)
